<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								商品名称：<input type="text" name="goodName"/>
							</li>

							<li>
								商品价格：<input type="text" name="goodPrice"/>
							</li>

							<li>
								单位：<input type="text" name="goodNuit"/>
							</li>

							<li>
								商品图片：<input type="text" name="goodPic"/>
							</li>

							<li>
								状态：<select name="goodStatus" th:with="type=${@dict.getType('v_good_status')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								商品简介：<input type="text" name="goodDesc"/>
							</li>

							<li class="select-time">
								<label>创建时间： </label>
								<input type="text" class="time-input" id="startGoodCtime" placeholder="开始" name="params[beginGoodCtime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endGoodCtime" placeholder="结束" name="params[endGoodCtime]"/>
							</li>
							<li>
								分类ID：<input type="text" name="goodItemId"/>
							</li>

							<li>
								门店ID：<input type="text" name="goodStoreId"/>
							</li>

							<li>
								删除状态：<select name="delState" th:with="type=${@dict.getType('v_good_delstate')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								详细描述：<input type="text" name="detailDescribe"/>
							</li>

							<li>
								推荐：<select name="recommend" th:with="type=${@dict.getType('v_good_recommend')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="store:vGood:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="store:vGood:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="store:vGood:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="store:vGood:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('store:vGood:edit')}]];
        var removeFlag = [[${@permission.hasPermi('store:vGood:remove')}]];
        var prefix = ctx + "store/vGood";
        var v_good_status_datas = [[${@dict.getType('v_good_status')}]];
        var v_good_delstate_datas = [[${@dict.getType('v_good_delstate')}]];
        var datas = [[${@dict.getType('v_good_recommend')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "商品管理",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'goodId', 
					title : '主键',
					visible: false
				},
				{
					field : 'goodName', 
					title : '商品名称',
					sortable: true
				},
				{
					field : 'goodPrice', 
					title : '商品价格',
					sortable: true
				},
				{
					field : 'goodNuit', 
					title : '单位',
					sortable: true
				},
				{
					field : 'goodPic', 
					title : '商品图片',
					sortable: true
				},
				{
					field : 'goodStatus', 
					title : '状态',
					sortable: true,
					formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(v_good_status_datas, value);
		            }
				},
				{
					field : 'goodDesc', 
					title : '商品简介',
					sortable: true
				},
				{
					field : 'goodCtime', 
					title : '创建时间',
					sortable: true
				},
				{
					field : 'goodItemId', 
					title : '分类ID',
					sortable: true
				},
				{
					field : 'goodStoreId', 
					title : '门店ID',
					sortable: true
				},
				{
					field : 'delState', 
					title : '删除状态',
					sortable: true,
					formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(v_good_delstate_datas, value);
		            }
				},
				{
					field : 'detailDescribe', 
					title : '详细描述',
					sortable: true
				},
				{
					field : 'recommend', 
					title : '推荐',
					sortable: true,
					formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(datas, value);
		            }
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.goodId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.goodId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>